package Code.Day11_20241012.com.dx.day11;

import java.io.File;
import java.io.IOException;

/**
 * @ClassName FileTest01
 * @Description 创建和删除文件
 * @Author 12994
 * @Date 2024/10/12 10:37
 * @Version 1.0
 **/
public class FileTest01 {
    public static void main(String[] args) {
        // 令JVM自动将unix路径转译至windows路径
        File file = new File("./test.txt");
        if (!file.isDirectory() && !file.isFile()) {
            try {
                if (file.createNewFile()) {
                    System.out.println("File create finish!");
                    if (file.delete()) {
                        System.out.println("File delete finish!");
                    }
                }
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
    }
}
